﻿using STT.DataAccess;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using STT.Entities;

namespace STT.Business
{
    public class BTbHocVien_PhanLop
    {
        public static DataTable SelectAll()
        {
            DataTable all = SqlHelper.ExecuteData(CommandType.StoredProcedure, "TbHocVien_PhanLop_SelectAll", null);
            return all;
        }

        public static DataTable SelectAllImport()
        {
            DataTable all = SqlHelper.ExecuteData(CommandType.StoredProcedure, "TbHocVien_PhanLop_SelectAllImport", null);
            return all;
        }

        public static void DeleteByMaHV(string MaHV)
        {
            SqlParameter[] pr = new SqlParameter[1];
            pr[0] = new SqlParameter(@"MaHV", MaHV);
            SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "TbHocVien_PhanLop_DeleteByMaHV", pr);
        }

        public static void Update_TrangThai_PhanLop(String MaHV, int ML)
        {
            SqlParameter[] pr = new SqlParameter[2];
            pr[0] = new SqlParameter(@"MaHV", MaHV);
            pr[1] = new SqlParameter(@"MaLop", ML);
            SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "HocVien_PhanLop_Update", pr);
        }

        public static void Insert_HocVien_PhanLop(String MaHV, String GC)
        {
            SqlParameter[] pr = new SqlParameter[2];
            pr[0] = new SqlParameter(@"MaHV", MaHV);
            pr[1] = new SqlParameter(@"MaLop", GC);
            SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "HocVien_PhanLop_Insert", pr);
        }

        public static void Delete_HocVien_PhanLop(String MaHV, String GC)
        {
            SqlParameter[] pr = new SqlParameter[2];
            pr[0] = new SqlParameter(@"MaHV", MaHV);
            pr[1] = new SqlParameter(@"MaLop", GC);
            SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "HocVien_PhanLop_Delete", pr);
        }

        public static void Insert(ETbHocVien_PhanLop HocVien_PhanLop)
        {
            SqlParameter[] pr = new SqlParameter[3];
            pr[0] = new SqlParameter(@"MaHV", HocVien_PhanLop.MaHV);
            pr[1] = new SqlParameter(@"MaLop", HocVien_PhanLop.MaLop);
            pr[2] = new SqlParameter(@"TrangThai", HocVien_PhanLop.TrangThai);
            SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "TbHocVien_PhanLop_Import", pr);
        }

    }
}